<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.zlib</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.zlib";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.zlib.html" class="symbol">std.zlib</a></h1>
  
<div class="summary">Compress/decompress data using the <a href="http://www._zlib.net">zlib library</a>.</div>
<p class="sec_header">References:</p><a href="http://en.wikipedia.org/wiki/Zlib">Wikipedia</a>
<p class="sec_header">License:</p>Public Domain
<dl>
<dt class="decl"><a class="symbol _enum" name="enum" href="./htmlsrc/std.zlib.html#L22" kind="enum" beg="22" end="28">enum</a>; <a title="Permalink to this symbol" href="#enum" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L22">#</a></dt>
<dd class="ddef">
<dl>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_NO_FLUSH" href="./htmlsrc/std.zlib.html#L24" kind="enummem" beg="24" end="24">Z_NO_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_NO_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L24">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_SYNC_FLUSH" href="./htmlsrc/std.zlib.html#L25" kind="enummem" beg="25" end="25">Z_SYNC_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_SYNC_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L25">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_FULL_FLUSH" href="./htmlsrc/std.zlib.html#L26" kind="enummem" beg="26" end="26">Z_FULL_FLUSH</a> <a title="Permalink to this symbol" href="#enum.Z_FULL_FLUSH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L26">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="enum.Z_FINISH" href="./htmlsrc/std.zlib.html#L27" kind="enummem" beg="27" end="27">Z_FINISH</a> <a title="Permalink to this symbol" href="#enum.Z_FINISH" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L27">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">class <a class="symbol _class" name="ZlibException" href="./htmlsrc/std.zlib.html#L34" kind="class" beg="34" end="53">ZlibException</a> : Exception; <a title="Permalink to this symbol" href="#ZlibException" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L34">#</a></dt>
<dd class="ddef">
<div class="summary">Errors throw a ZlibException.</div>
<dl>
<dt class="decl"><a class="symbol _ctor" name="ZlibException.this" href="./htmlsrc/std.zlib.html#L36" kind="ctor" beg="36" end="52">this</a><span class="params">(int <em>errnum</em>)</span>; <a title="Permalink to this symbol" href="#ZlibException.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L36">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">uint <a class="symbol _function" name="adler32" href="./htmlsrc/std.zlib.html#L60" kind="function" beg="60" end="63">adler32</a><span class="params">(uint <em>adler</em>, void[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#adler32" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L60">#</a></dt>
<dd class="ddef">
<div class="summary">Compute the Adler32 checksum of the data in buf[]. adler is the starting
 value when computing a cumulative checksum.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.zlib.html#L65" kind="unittest" beg="65" end="75">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L65">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">uint <a class="symbol _function" name="crc32" href="./htmlsrc/std.zlib.html#L82" kind="function" beg="82" end="85">crc32</a><span class="params">(uint <em>crc</em>, void[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#crc32" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L82">#</a></dt>
<dd class="ddef">
<div class="summary">Compute the CRC32 checksum of the data in buf[]. crc is the starting value
 when computing a cumulative checksum.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:2" href="./htmlsrc/std.zlib.html#L87" kind="unittest" beg="87" end="97">unittest</a>; <a title="Permalink to this symbol" href="#unittest:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L87">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void[] <a class="symbol _function" name="compress" href="./htmlsrc/std.zlib.html#L107" kind="function" beg="107" end="128">compress</a><span class="params">(void[] <em>srcbuf</em>, int <em>level</em>)</span>; <a title="Permalink to this symbol" href="#compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L107">#</a></dt>
<dt class="decl">void[] <a class="symbol _function" name="compress:2" href="./htmlsrc/std.zlib.html#L134" kind="function" beg="134" end="137">compress</a><span class="params">(void[] <em>buf</em>)</span>; <a title="Permalink to this symbol" href="#compress:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L134">#</a></dt>
<dd class="ddef">
<div class="summary">Compresses the data in srcbuf[] using compression _level level.
 The default value
 for level is 6, legal values are 1..9, with 1 being the least compression
 and 9 being the most.
 Returns the compressed data.</div></dd>
<dt class="decl">void[] <a class="symbol _function" name="uncompress" href="./htmlsrc/std.zlib.html#L147" kind="function" beg="147" end="194">uncompress</a><span class="params">(void[] <em>srcbuf</em>, uint <em>destlen</em> = 0u, int <em>winbits</em> = 15)</span>; <a title="Permalink to this symbol" href="#uncompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L147">#</a></dt>
<dd class="ddef">
<div class="summary">Decompresses the data in srcbuf[].</div>
<p class="sec_header">Params:</p>
<table class="params">
<tr><td><em>destlen</em></td><td>size of the uncompressed data.
 It need not be accurate, but the decompression will be faster if the exact
 size is supplied.</td></tr></table>
<p class="sec_header">Returns:</p>the decompressed data.</dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:3" href="./htmlsrc/std.zlib.html#L196" kind="unittest" beg="196" end="211">unittest</a>; <a title="Permalink to this symbol" href="#unittest:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L196">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">class <a class="symbol _class" name="Compress" href="./htmlsrc/std.zlib.html#L231" kind="class" beg="231" end="386">Compress</a>; <a title="Permalink to this symbol" href="#Compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L231">#</a></dt>
<dd class="ddef">
<div class="summary">Used when the data to be compressed is not all in one buffer.</div>
<dl>
<dt class="decl">z_stream <a class="symbol _variable" name="Compress.zs" href="./htmlsrc/std.zlib.html#L234" kind="variable" beg="234" end="234">zs</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.zs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L234">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="Compress.level" href="./htmlsrc/std.zlib.html#L235" kind="variable" beg="235" end="235">level</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.level" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L235">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="Compress.inited" href="./htmlsrc/std.zlib.html#L236" kind="variable" beg="236" end="236">inited</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.inited" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L236">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="Compress.error" href="./htmlsrc/std.zlib.html#L238" kind="function" beg="238" end="245">error</a><span class="params">(int <em>err</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#Compress.error" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L238">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _ctor" name="Compress.this" href="./htmlsrc/std.zlib.html#L252" kind="ctor" beg="252" end="260">this</a><span class="params">(int <em>level</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L252">#</a></dt>
<dt class="decl"><a class="symbol _ctor" name="Compress.this:2" href="./htmlsrc/std.zlib.html#L263" kind="ctor" beg="263" end="265">this</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L263">#</a></dt>
<dd class="ddef">
<div class="summary">Construct. level is the same as for D.zlib.compress().</div></dd>
<dt class="decl"><a class="symbol _dtor" name="Compress.~this" href="./htmlsrc/std.zlib.html#L267" kind="dtor" beg="267" end="277">~this</a>(); <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.~this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L267">#</a></dt>

<dt class="decl">void[] <a class="symbol _function" name="Compress.compress" href="./htmlsrc/std.zlib.html#L284" kind="function" beg="284" end="316">compress</a><span class="params">(void[] <em>buf</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.compress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L284">#</a></dt>
<dd class="ddef">
<div class="summary">Compress the data in buf and return the compressed data.
 The buffers
 returned from successive calls to this should be concatenated together.</div></dd>
<dt class="decl">void[] <a class="symbol _function" name="Compress.flush" href="./htmlsrc/std.zlib.html#L336" kind="function" beg="336" end="385">flush</a><span class="params">(int <em>mode</em> = Z_FINISH)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#Compress.flush" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L336">#</a></dt>
<dd class="ddef">
<div class="summary">Compress and return any remaining data.
 The returned data should be appended to that returned by compress().</div>
<p class="sec_header">Params:</p>
<table class="params">
<tr><td><em>mode</em></td><td>one of the following: 
		<dl>
		    <dt>Z_SYNC_FLUSH </dt>
		    <dd>Syncs up flushing to the next byte boundary.
			Used when more data is to be compressed later on.</dd>
		    <dt>Z_FULL_FLUSH </dt>
		    <dd>Syncs up flushing to the next byte boundary.
			Used when more data is to be compressed later on,
			and the decompressor needs to be restartable at this
			point.</dd>
		    <dt>Z_FINISH</dt>
		    <dd>(default) Used when finished compressing the data. </dd>
		</dl></td></tr></table></dd></dl></dd>
<dt class="decl">class <a class="symbol _class" name="UnCompress" href="./htmlsrc/std.zlib.html#L392" kind="class" beg="392" end="534">UnCompress</a>; <a title="Permalink to this symbol" href="#UnCompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L392">#</a></dt>
<dd class="ddef">
<div class="summary">Used when the data to be decompressed is not all in one buffer.</div>
<dl>
<dt class="decl">z_stream <a class="symbol _variable" name="UnCompress.zs" href="./htmlsrc/std.zlib.html#L395" kind="variable" beg="395" end="395">zs</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.zs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L395">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="UnCompress.inited" href="./htmlsrc/std.zlib.html#L396" kind="variable" beg="396" end="396">inited</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.inited" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L396">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _variable" name="UnCompress.done" href="./htmlsrc/std.zlib.html#L397" kind="variable" beg="397" end="397">done</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.done" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L397">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">uint <a class="symbol _variable" name="UnCompress.destbufsize" href="./htmlsrc/std.zlib.html#L398" kind="variable" beg="398" end="398">destbufsize</a>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.destbufsize" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L398">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="UnCompress.error" href="./htmlsrc/std.zlib.html#L400" kind="function" beg="400" end="407">error</a><span class="params">(int <em>err</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.error" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L400">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _ctor" name="UnCompress.this" href="./htmlsrc/std.zlib.html#L414" kind="ctor" beg="414" end="417">this</a><span class="params">(uint <em>destbufsize</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L414">#</a></dt>
<dt class="decl"><a class="symbol _ctor" name="UnCompress.this:2" href="./htmlsrc/std.zlib.html#L420" kind="ctor" beg="420" end="422">this</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L420">#</a></dt>
<dd class="ddef">
<div class="summary">Construct. destbufsize is the same as for D.zlib.uncompress().</div></dd>
<dt class="decl"><a class="symbol _dtor" name="UnCompress.~this" href="./htmlsrc/std.zlib.html#L424" kind="dtor" beg="424" end="435">~this</a>(); <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.~this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L424">#</a></dt>

<dt class="decl">void[] <a class="symbol _function" name="UnCompress.uncompress" href="./htmlsrc/std.zlib.html#L442" kind="function" beg="442" end="481">uncompress</a><span class="params">(void[] <em>buf</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.uncompress" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L442">#</a></dt>
<dd class="ddef">
<div class="summary">Decompress the data in buf and return the decompressed data.
 The buffers returned from successive calls to this should be concatenated
 together.</div></dd>
<dt class="decl">void[] <a class="symbol _function" name="UnCompress.flush" href="./htmlsrc/std.zlib.html#L488" kind="function" beg="488" end="533">flush</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#UnCompress.flush" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L488">#</a></dt>
<dd class="ddef">
<div class="summary">Decompress and return any remaining data.
 The returned data should be appended to that returned by uncompress().
 The UnCompress object cannot be used further.</div></dd></dl></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:4" href="./htmlsrc/std.zlib.html#L541" kind="unittest" beg="541" end="593">unittest</a>; <a title="Permalink to this symbol" href="#unittest:4" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L541">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:5" href="./htmlsrc/std.zlib.html#L596" kind="unittest" beg="596" end="611">unittest</a>; <a title="Permalink to this symbol" href="#unittest:5" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.zlib.html#L596">#</a></dt>
<dd class="ddef"></dd></dl>
</div>
<div id="footer">
  <p>Copyright © 1999-2008 by Digital Mars ®, All Rights Reserved.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Fri Dec 26 03:40:15 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>